<%= form_for(@document, :html => {:multipart => true})   do |f| %>
  <% if @document.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@document.errors.count, "error") %> prohibited this document from being saved:</h2>

      <ul>
      <% @document.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :title %><br />
    <%= f.text_field :title %>
  </div>
  <div class="field">
    <%= f.label :description %><br />
    <%= f.text_area :description ,:rows => 10 , :cols => 50 %>
  </div>
  <div class="field">
    <%= f.label :attachment %><br />
    <%= f.file_field :attachment%>
  </div>
   
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>
<script>

var f1 = new LiveValidation('document_title');
f1.add( Validate.Presence );
var f2 = new LiveValidation('document_attachment');
f2.add( Validate.Presence );

</script>

